function initPage(baseInfoJson,basicInfo){
	var basePath = $("#basePath").val();
	var medicalPayMentTypesData = baseInfoJson['medicalPayMentTypes'];//付费方式
	var marriages=baseInfoJson['marriages'];//婚姻
	var sexs=baseInfoJson['sexs'];//性别
	var idDocumentTypes=baseInfoJson['idDocumentTypes'];//证件类型
	var nationalitys=baseInfoJson['nationalitys'];//国籍
	var nations=baseInfoJson['nations'];//民族
	var relativeRelations=baseInfoJson['relativeRelations'];//与病人关系
	var inHospitalTypes=baseInfoJson['inHospitalTypes'];//入院途径
	var inHospitalStates=baseInfoJson['inHospitalStates'];//入院状况
	var outHospitalTypes=baseInfoJson['outHospitalTypes'];//离院方式
	var professions=baseInfoJson['professions'];//职业
	var medicalDepts=baseInfoJson['medicalDepts'];//科室
	
	var rehospitalAims=baseInfoJson['rehospitalAims'];//在住院目的
	
	var hospitalDealthReasons=baseInfoJson['hospitalDealthReasons'];//死亡原因

	$("select").each(function(){
		$(this).append("<option value=''>---请选择---</option>");
		
	});
	
	$("#medicalPayTypeCode").each(function(){
		var options = "";
		for(var index in medicalPayMentTypesData){
			var medicalPayMentType = medicalPayMentTypesData[index];
	    	options+="<option value='"+medicalPayMentType.uniq_code+"'>"+medicalPayMentType.label+"</option>"
	    } 
       $(this).append(options);
       $(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	var medicalPayTypeOjb = $("#medicalPayTypeCode");
	if(basicInfo.medicalPayTypeCode){
		
		var selectOption = medicalPayTypeOjb.find("option[value='"+basicInfo.medicalPayTypeCode+"']")
		if(selectOption.length > 0){
			selectOption.attr("selected",true);
		}else{
			medicalPayTypeOjb.append("<option selected='selected' value='"+basicInfo.medicalPayTypeCode+"'>"+basicInfo.medicalPayTypeName+"</option>");
		}
		
	}
	var medicalPayTypeName = medicalPayTypeOjb.attr("name").replace("Code", "Name");
	medicalPayTypeOjb.next("input[name='"+medicalPayTypeName+"']").val(basicInfo.medicalPayTypeName);
	//婚姻下拉框
	$("#marriageCode").each(function(){
		var options = "";
		for(var index in marriages){
			var marriage = marriages[index];
	    	options+="<option value='"+marriage.uniq_code+"'>"+marriage.label+"</option>"
	    } 
       $(this).append(options);
       $(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	
	var marriageCodeOjb = $("#marriageCode");
	if(basicInfo.marriageCode){
		
		var selectOption = marriageCodeOjb.find("option[value='"+basicInfo.marriageCode+"']")
		if(selectOption.length > 0){
			selectOption.attr("selected",true);
		}else{
			marriageCodeOjb.append("<option selected='selected' value='"+basicInfo.marriageCode+"'>"+basicInfo.marriageName+"</option>");
		}
		
	}
	marriageCodeOjb.next("input[name='"+marriageCodeOjb.attr("name").replace("Code", "Name")+"']").val(basicInfo.marriageName);
	
	
	$( ".medical_worker_search_input" ).autocomplete({
		source: function( request, response ) {
			var eventObj = $(this.element);
			
			var codeObjName = eventObj.attr("name").replace("Name", "Code");
			eventObj.next("input[name='"+codeObjName+"']").val("");
			/* eventObj.next("input[data-code='search_input1']").val(""); */
			$.ajax({
				url: basePath + "base_info/ajax_medical_worker_by_query_name",
				dataType: "json",
				data:{
					queryName: request.term
				},
				success: function( data ) {
				response( $.map( data, function( item ) {
					return {
						label:item.label,
						uniq_code:item.uniq_code
					}
				}));
			}
		});
		},
		minLength: 1,
		select: function( event, ui ) {
			var eventObj = $(this);
			var item = ui.item;
			var codeObjName = eventObj.attr("name").replace("Name", "Code");
			eventObj.next("input[name='"+codeObjName+"']").val(item.uniq_code);
			/* eventObj.next("input[data-code='search_input1']").val(item.code); */
		},search: function( event, ui ) {
			var eventObj = $(this);
			/* eventObj.next("input[data-code='search_input1']").val(""); */
			var codeObjName = eventObj.attr("name").replace("Name", "Code");
			eventObj.next("input[name='"+codeObjName+"']").val("");
		}
	});
	//性别下拉框
	$("#sexCode").each(function(){
		var options = "";
		for(var index in sexs){
			var sex = sexs[index];
	    	options+="<option value='"+sex.uniq_code+"'>"+sex.label+"</option>"
	    } 
       $(this).append(options);
       $(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	
	var sexCodeOjb = $("#sexCode");
	if(basicInfo.sexCode){
		
		var selectOption = sexCodeOjb.find("option[value='"+basicInfo.sexCode+"']")
		if(selectOption.length > 0){
			selectOption.attr("selected",true);
		}else{
			sexCodeOjb.append("<option selected='selected' value='"+basicInfo.sexCode+"'>"+basicInfo.sexName+"</option>");
		}
		
	}
	sexCodeOjb.next("input[name='"+sexCodeOjb.attr("name").replace("Code", "Name")+"']").val(basicInfo.sexName);
	
	//证件类型
	$("#idDocumentTypeCode").each(function(){
		var options = "";
		for(var index in idDocumentTypes){
			var idDocumentType = idDocumentTypes[index];
	    	options+="<option value='"+idDocumentType.uniq_code+"'>"+idDocumentType.label+"</option>"
	    } 
       $(this).append(options);
       $(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});

	
	var idDocumentTypeOjb = $("#idDocumentTypeCode");
	if(basicInfo.idDocumentTypeCode){
		
		var selectOption = idDocumentTypeOjb.find("option[value='"+basicInfo.idDocumentTypeCode+"']")
		if(selectOption.length > 0){
			selectOption.attr("selected",true);
		}else{
			idDocumentTypeOjb.append("<option selected='selected' value='"+basicInfo.idDocumentTypeCode+"'>"+basicInfo.idDocumentTypeName+"</option>");
		}
		
	}
	var idDocumentTypeName = idDocumentTypeOjb.attr("name").replace("Code", "Name");
	idDocumentTypeOjb.next("input[name='"+idDocumentTypeName+"']").val(basicInfo.idDocumentTypeName);
	//国籍
	$("#nationalityCode").each(function(){
		var options = "";
		for(var index in nationalitys){
			var nationality = nationalitys[index];
	    	options+="<option value='"+nationality.uniq_code+"'>"+nationality.label+"</option>"
	    } 
       $(this).append(options);
       $(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	
	var nationalityCodeOjb = $("#nationalityCode");
	if(basicInfo.nationalityCode){
		
		var selectOption = nationalityCodeOjb.find("option[value='"+basicInfo.nationalityCode+"']")
		if(selectOption.length > 0){
			selectOption.attr("selected",true);
		}else{
			nationalityCodeOjb.append("<option selected='selected' value='"+basicInfo.nationalityCode+"'>"+basicInfo.nationalityName+"</option>");
		}
		
	}
	nationalityCodeOjb.next("input[name='"+nationalityCodeOjb.attr("name").replace("Code", "Name")+"']").val(basicInfo.nationalityName);
	
	
	//民族
	$("#nationCode").each(function(){
		var options = "";
		for(var index in nations){
			var nation = nations[index];
	    	options+="<option value='"+nation.uniq_code+"'>"+nation.label+"</option>"
	    } 
       $(this).append(options);
       $(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	var nationCodeOjb = $("#nationCode");
	if(basicInfo.nationCode){
		
		var selectOption = nationCodeOjb.find("option[value='"+basicInfo.nationCode+"']")
		if(selectOption.length > 0){
			selectOption.attr("selected",true);
		}else{
			nationCodeOjb.append("<option selected='selected' value='"+basicInfo.nationCode+"'>"+basicInfo.nationName+"</option>");
		}
		
	}
	nationCodeOjb.next("input[name='"+nationCodeOjb.attr("name").replace("Code", "Name")+"']").val(basicInfo.nationName);
	
	var tjIdentifys=baseInfoJson['tjIdentifys'];//身份
	
	$("#personnelCategorySelect").each(function(){
		var options = "";
		for(var index in tjIdentifys){
			var tjIdentify = tjIdentifys[index];
	    	options+="<option value='"+tjIdentify.uniq_code+"'>"+tjIdentify.label+"</option>"
	    } 
       $(this).append(options);
       $(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	var personnelCategoryCodeOjb = $("#personnelCategorySelect");
	if(basicInfo.personnelCategoryCode){
		
		var selectOption = personnelCategoryCodeOjb.find("option[value='"+basicInfo.personnelCategoryCode+"']")
		if(selectOption.length > 0){
			selectOption.attr("selected",true);
		}else{
			personnelCategoryCodeOjb.append("<option selected='selected' value='"+basicInfo.personnelCategoryCode+"'>"+basicInfo.personnelCategoryName+"</option>");
		}
		
	}
	personnelCategoryCodeOjb.next("input[name='"+personnelCategoryCodeOjb.attr("name").replace("Code", "Name")+"']").val(basicInfo.personnelCategoryName);
	
	
	var tjTopUnits=baseInfoJson['tjTopUnits'];//大单位
	
	$("#majorUnitSelect").each(function(){
		var options = "";
		for(var index in tjTopUnits){
			var tjTopUnit = tjTopUnits[index];
	    	options+="<option value='"+tjTopUnit.uniq_code+"'>"+tjTopUnit.label+"</option>"
	    } 
       $(this).append(options);
       $(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	var majorUnitCodeOjb = $("#majorUnitSelect");
	if(basicInfo.majorUnitCode){
		
		var selectOption = majorUnitCodeOjb.find("option[value='"+basicInfo.majorUnitCode+"']")
		if(selectOption.length > 0){
			selectOption.attr("selected",true);
		}else{
			majorUnitCodeOjb.append("<option selected='selected' value='"+basicInfo.majorUnitCode+"'>"+basicInfo.majorUnitName+"</option>");
		}
		
	}
	majorUnitCodeOjb.next("input[name='"+majorUnitCodeOjb.attr("name").replace("Code", "Name")+"']").val(basicInfo.majorUnitName);
	
	var tjDutys=baseInfoJson['tjDutys'];//勤务
	
	$("#troopServiceSelect").each(function(){
		var options = "";
		for(var index in tjDutys){
			var tjDuty = tjDutys[index];
	    	options+="<option value='"+tjDuty.uniq_code+"'>"+tjDuty.label+"</option>"
	    } 
       $(this).append(options);
       $(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	var troopServiceCodeOjb = $("#troopServiceSelect");
	if(basicInfo.troopServiceCode){
		
		var selectOption = troopServiceCodeOjb.find("option[value='"+basicInfo.troopServiceCode+"']")
		if(selectOption.length > 0){
			selectOption.attr("selected",true);
		}else{
			troopServiceCodeOjb.append("<option selected='selected' value='"+basicInfo.troopServiceCode+"'>"+basicInfo.troopServiceName+"</option>");
		}
		
	}
	troopServiceCodeOjb.next("input[name='"+troopServiceCodeOjb.attr("name").replace("Code", "Name")+"']").val(basicInfo.troopServiceName);
	
	
	//医疗体系
	$("#medicalSystemSelect").each(function(){
		var options = "<option value='0'>非体系病人</option>";
		options+="<option value='1'>体系病人</option>"
		options+="<option value='9'>其他</option>"
		
       $(this).append(options);
       $(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	var medicalSystemCodeOjb = $("#medicalSystemSelect");
	if(basicInfo.medicalSystemCode){
		
		var selectOption = medicalSystemCodeOjb.find("option[value='"+basicInfo.medicalSystemCode+"']")
		if(selectOption.length > 0){
			selectOption.attr("selected",true);
		}else{
			medicalSystemCodeOjb.append("<option selected='selected' value='"+basicInfo.medicalSystemCode+"'>"+basicInfo.medicalSystemName+"</option>");
		}
		
	}
	medicalSystemCodeOjb.next("input[name='"+medicalSystemCodeOjb.attr("name").replace("Code", "Name")+"']").val(basicInfo.medicalSystemName);
	
	
	$("#idTypeSelect").each(function(){
		var options = "";
		for(var index in tjIdentifys){
			var tjIdentify = tjIdentifys[index];
	    	options+="<option value='"+tjIdentify.uniq_code+"'>"+tjIdentify.label+"</option>"
	    } 
       $(this).append(options);
       $(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	var idTypeCodeOjb = $("#idTypeSelect");
	if(basicInfo.idTypeCode){
		
		var selectOption = idTypeCodeOjb.find("option[value='"+basicInfo.idTypeCode+"']")
		if(selectOption.length > 0){
			selectOption.attr("selected",true);
		}else{
			idTypeCodeOjb.append("<option selected='selected' value='"+basicInfo.idTypeCode+"'>"+basicInfo.idTypeName+"</option>");
		}
		
	}
	idTypeCodeOjb.next("input[name='"+idTypeCodeOjb.attr("name").replace("Code", "Name")+"']").val(basicInfo.idTypeName);
	
	
	var tjChargeTypes=baseInfoJson['tjChargeTypes'];//费别
	
	$("#costTypeSelect").each(function(){
		var options = "";
		for(var index in tjChargeTypes){
			var tjChargeType = tjChargeTypes[index];
	    	options+="<option value='"+tjChargeType.uniq_code+"'>"+tjChargeType.label+"</option>"
	    } 
       $(this).append(options);
       $(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	var costTypeCodeOjb = $("#costTypeSelect");
	if(basicInfo.costTypeCode){
		
		var selectOption = costTypeCodeOjb.find("option[value='"+basicInfo.costTypeCode+"']")
		if(selectOption.length > 0){
			selectOption.attr("selected",true);
		}else{
			costTypeCodeOjb.append("<option selected='selected' value='"+basicInfo.costTypeCode+"'>"+basicInfo.costTypeName+"</option>");
		}
		
	}
	costTypeCodeOjb.next("input[name='"+costTypeCodeOjb.attr("name").replace("Code", "Name")+"']").val(basicInfo.costTypeName);
	
	
	//在职状况
	$("#jobStateSelect").each(function(){
		var options = "<option value='0'>在职</option>";
		options+="<option value='1'>离职</option>"
		options+="<option value='2'>退休</option>"
		
       $(this).append(options);
       $(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	var jobStateCodeOjb = $("#jobStateSelect");
	if(basicInfo.jobStateCode){
		
		var selectOption = jobStateCodeOjb.find("option[value='"+basicInfo.jobStateCode+"']")
		if(selectOption.length > 0){
			selectOption.attr("selected",true);
		}else{
			jobStateCodeOjb.append("<option selected='selected' value='"+basicInfo.jobStateCode+"'>"+basicInfo.jobStateName+"</option>");
		}
		
	}
	jobStateCodeOjb.next("input[name='"+jobStateCodeOjb.attr("name").replace("Code", "Name")+"']").val(basicInfo.jobStateName);
	
	
	//军事训练伤
	$("#militaryTrainingInjurySelect").each(function(){
		var options = "<option value='0'>是</option>";
		options+="<option value='1'>否</option>";
		
       $(this).append(options);
       $(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	var militaryTrainingInjuryCodeOjb = $("#militaryTrainingInjurySelect");
	if(basicInfo.militaryTrainingInjuryCode){
		
		var selectOption = militaryTrainingInjuryCodeOjb.find("option[value='"+basicInfo.militaryTrainingInjuryCode+"']")
		if(selectOption.length > 0){
			selectOption.attr("selected",true);
		}else{
			militaryTrainingInjuryCodeOjb.append("<option selected='selected' value='"+basicInfo.militaryTrainingInjuryCode+"'>"+basicInfo.militaryTrainingInjuryName+"</option>");
		}
		
	}
	militaryTrainingInjuryCodeOjb.next("input[name='"+militaryTrainingInjuryCodeOjb.attr("name").replace("Code", "Name")+"']").val(basicInfo.militaryTrainingInjuryName);
	
	
	//与病人关系
	$("#linkManRelativeRelationCode").each(function(){
		var options = "";
		for(var index in relativeRelations){
			var relativeRelation = relativeRelations[index];
	    	options+="<option value='"+relativeRelation.uniq_code+"'>"+relativeRelation.label+"</option>"
	    } 
       $(this).append(options);
       $(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	
	var linkManRelativeRelationCodeOjb = $("#linkManRelativeRelationCode");
	if(basicInfo.linkManRelativeRelationCode){
		
		var selectOption = linkManRelativeRelationCodeOjb.find("option[value='"+basicInfo.linkManRelativeRelationCode+"']")
		if(selectOption.length > 0){
			selectOption.attr("selected",true);
		}else{
			linkManRelativeRelationCodeOjb.append("<option selected='selected' value='"+basicInfo.linkManRelativeRelationCode+"'>"+basicInfo.linkManRelativeRelationName+"</option>");
		}
		
	}
	linkManRelativeRelationCodeOjb.next("input[name='"+linkManRelativeRelationCodeOjb.attr("name").replace("Code", "Name")+"']").val(basicInfo.linkManRelativeRelationName);
	
	
	//入院途径
	$("#inHospitalTypeCode").each(function(){
		var options = "";
		for(var index in inHospitalTypes){
			var inHospitalType = inHospitalTypes[index];
	    	options+="<option value='"+inHospitalType.uniq_code+"'>"+inHospitalType.label+"</option>"
	    } 
       $(this).append(options);
       $(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	
	var inHospitalTypeCodeOjb = $("#inHospitalTypeCode");
	if(basicInfo.inHospitalTypeCode){
		
		var selectOption = inHospitalTypeCodeOjb.find("option[value='"+basicInfo.inHospitalTypeCode+"']")
		if(selectOption.length > 0){
			selectOption.attr("selected",true);
		}else{
			inHospitalTypeCodeOjb.append("<option selected='selected' value='"+basicInfo.inHospitalTypeCode+"'>"+basicInfo.inHospitalTypeName+"</option>");
		}
		
	}
	inHospitalTypeCodeOjb.next("input[name='"+inHospitalTypeCodeOjb.attr("name").replace("Code", "Name")+"']").val(basicInfo.inHospitalTypeName);
	
	
	//入院状况
	$("#inHospitalStateCode").each(function(){
		var options = "";
		for(var index in inHospitalStates){
			var inHospitalState = inHospitalStates[index];
	    	options+="<option value='"+inHospitalState.uniq_code+"'>"+inHospitalState.label+"</option>"
	    } 
       $(this).append(options);
       $(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	
	var inHospitalStateCodeOjb = $("#inHospitalStateCode");
	if(basicInfo.inHospitalStateCode){
		
		var selectOption = inHospitalStateCodeOjb.find("option[value='"+basicInfo.inHospitalStateCode+"']")
		if(selectOption.length > 0){
			selectOption.attr("selected",true);
		}else{
			inHospitalStateCodeOjb.append("<option selected='selected' value='"+basicInfo.inHospitalStateCode+"'>"+basicInfo.inHospitalStateName+"</option>");
		}
		
	}
	inHospitalStateCodeOjb.next("input[name='"+inHospitalStateCodeOjb.attr("name").replace("Code", "Name")+"']").val(basicInfo.inHospitalStateName);
	
	
	
	//离院方式
	$("#outHospitalTypeCode").each(function(){
		var options = "";
		for(var index in outHospitalTypes){
			var outHospitalType = outHospitalTypes[index];
	    	options+="<option value='"+outHospitalType.uniq_code+"'>"+outHospitalType.label+"</option>"
	    } 
       $(this).append(options);
       $(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	
	var outHospitalTypeCodeOjb = $("#outHospitalTypeCode");
	if(basicInfo.outHospitalTypeCode){
		
		var selectOption = outHospitalTypeCodeOjb.find("option[value='"+basicInfo.outHospitalTypeCode+"']")
		if(selectOption.length > 0){
			selectOption.attr("selected",true);
		}else{
			outHospitalTypeCodeOjb.append("<option selected='selected' value='"+basicInfo.outHospitalTypeCode+"'>"+basicInfo.outHospitalTypeName+"</option>");
		}
		
	}
	outHospitalTypeCodeOjb.next("input[name='"+outHospitalTypeCodeOjb.attr("name").replace("Code", "Name")+"']").val(basicInfo.outHospitalTypeName);
	
	
	//职业
	$("#professionCode").each(function(){
		var options = "";
		for(var index in professions){
			var profession = professions[index];
	    	options+="<option value='"+profession.uniq_code+"'>"+profession.label+"</option>"
	    } 
       $(this).append(options);
       $(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	
	var professionCodeOjb = $("#professionCode");
	if(basicInfo.professionCode){
		
		var selectOption = professionCodeOjb.find("option[value='"+basicInfo.professionCode+"']")
		if(selectOption.length > 0){
			selectOption.attr("selected",true);
		}else{
			professionCodeOjb.append("<option selected='selected' value='"+basicInfo.professionCode+"'>"+basicInfo.professionName+"</option>");
		}
		
	}
	professionCodeOjb.next("input[name='"+professionCodeOjb.attr("name").replace("Code", "Name")+"']").val(basicInfo.professionName);
	
	
	//入院科室
	$("#inDeptCode").each(function(){
		var options = "";
		for(var index in medicalDepts){
			var medicalDept = medicalDepts[index];
	    	options+="<option value='"+medicalDept.uniq_code+"'>"+medicalDept.label+"</option>"
	    } 
       $(this).append(options);
       $(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	
	var inDeptCodeOjb = $("#inDeptCode");
	if(basicInfo.inDeptCode){
		
		var selectOption = inDeptCodeOjb.find("option[value='"+basicInfo.inDeptCode+"']")
		if(selectOption.length > 0){
			selectOption.attr("selected",true);
		}else{
			inDeptCodeOjb.append("<option selected='selected' value='"+basicInfo.inDeptCode+"'>"+basicInfo.inDeptName+"</option>");
		}
		
	}
	inDeptCodeOjb.next("input[name='"+inDeptCodeOjb.attr("name").replace("Code", "Name")+"']").val(basicInfo.inDeptName);
	
	//出院科室
	$("#outDeptCode").each(function(){
		var options = "";
		for(var index in medicalDepts){
			var medicalDept = medicalDepts[index];
	    	options+="<option value='"+medicalDept.uniq_code+"'>"+medicalDept.label+"</option>"
	    } 
       $(this).append(options);
       $(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	var outDeptCodeOjb = $("#outDeptCode");
	if(basicInfo.outDeptCode){
		
		var selectOption = outDeptCodeOjb.find("option[value='"+basicInfo.outDeptCode+"']")
		if(selectOption.length > 0){
			selectOption.attr("selected",true);
		}else{
			outDeptCodeOjb.append("<option selected='selected' value='"+basicInfo.outDeptCode+"'>"+basicInfo.outDeptName+"</option>");
		}
		
	}
	outDeptCodeOjb.next("input[name='"+outDeptCodeOjb.attr("name").replace("Code", "Name")+"']").val(basicInfo.outDeptName);
	
	
	$("#rehospitalAimCode").each(function(){
		var options = "";
		for(var index in rehospitalAims){
			var rehospitalAim = rehospitalAims[index];
	    	options+="<option value='"+rehospitalAim.uniq_code+"'>"+rehospitalAim.label+"</option>"
	    } 
       $(this).append(options);
       $(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
       
       if(basicInfo.rehospitalAimCode){
   		
	   		var selectOption = $(this).find("option[value='"+basicInfo.rehospitalAimCode+"']")
	   		if(selectOption.length > 0){
	   			selectOption.attr("selected",true);
	   		}else{
	   			$(this).append("<option selected='selected' value='"+basicInfo.rehospitalAimCode+"'>"+basicInfo.rehospitalAimName+"</option>");
	   		}
	   		
	   	}
       $(this).next("input[name='"+$(this).attr("name").replace("Code", "Name")+"']").val(basicInfo.rehospitalAimName);
	   	
	});
	
	
	
	
	$("#dealthReasonCode").each(function(){
		var options = "";
		for(var index in hospitalDealthReasons){
			var hospitalDealthReason = hospitalDealthReasons[index];
	    	options+="<option value='"+hospitalDealthReason.uniq_code+"'>"+hospitalDealthReason.label+"</option>"
	    } 
       $(this).append(options);
       $(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
       if(basicInfo.dealthReasonCode){
      		
	   		var selectOption = $(this).find("option[value='"+basicInfo.dealthReasonCode+"']")
	   		if(selectOption.length > 0){
	   			selectOption.attr("selected",true);
	   		}else{
	   			$(this).append("<option selected='selected' value='"+basicInfo.dealthReasonCode+"'>"+basicInfo.dealthReasonName+"</option>");
	   		}
	   		
	   	}
      $(this).next("input[name='"+$(this).attr("name").replace("Code", "Name")+"']").val(basicInfo.dealthReasonName);
	   
	});
	
	$("input[name='autopsyCode']").each(function(){
		 $(this).click(function(){
			 var autopsyNameValue = "";
			 if($(this).val()=="1"){
				 autopsyNameValue = "是";
			 }else if($(this).val()=="0"){
				 autopsyNameValue = "否";
			 }
			 $(this).nextAll("input[name='"+$(this).attr("name").replace("Code", "Name")+"']").val(autopsyNameValue);
		 });
	});
	
	if(basicInfo.autopsyCode){
		$("input[name='autopsyCode'][value='"+basicInfo.autopsyCode+"']").attr("checked",true);
	}
	$("input[name='autopsyName']").val(basicInfo.autopsyName);
	$("#saveBaseBtn").removeAttr("disabled");
}

function homePageBasicDataSave(){
	$("[title='']").focus(function() { 
		$("[title='']").each(function() {
	  		$("[title='']").removeClass("input_list");
	  		
		});
 	});
	var num=0;//变量为1时 数据为空
   
    var notNull=false;//变量为true时提交数据
	$("[title='']").each(function() { //遍历元素对象   
      if ($(this).val()=="") { //判断元素对象的value值  
            $(this).addClass("input_list");  //添加css样式  
          num=1;
      }else{  
    	  notNull=true;
      }  

    }); 
    if(num==1){
	 	  alert("必选项不能为空!");
		  notNull=false;
		  return;
	}
	if(notNull==true){
		var age=$("#age").val();
		if(age!=null && age!=''){
			if(age<1 || age>150){
				alert("年龄范围不能小于0,或者大于150岁");
				return;
			}
		}
	}
	layer.load();
	$("#basicDataForm").submit();
	
}